<?php
/**
 * Created by PhpStorm.
 * User: zhangbing
 * Date: 2017/3/16 0016
 * Time: 17:00
 */
namespace app\admin\validate;
use think\Validate;

class UserType extends Validate{
    //定义验证规则
    protected $rule = [
        'name' => 'require|max:50',
    ];

    //定义错误信息
    protected $message = [
        'name.require' => '用户类型不能为空',
        'name.max'     => '用户类型不能超过50个字符',
    ];

    //验证场景
    protected $scene = [
        'add'  =>  ['name'],
        'save'  =>  ['name'],
    ];
}